<extend name="Public/base" />

<block name="body">
	<div class="main-title cf">
		<h2>业务员管理界面</h2>
	</div>
	<!-- 标签页导航 -->
	<button class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">+新增</button>
	<div class="tab-wrap">
		<div class="data-table table-striped">
			<table class="table table-hover" style="width:80%">
				<thead>
					<tr>
						<th>业务员姓名</th>
						<th>业务员手机</th>
						<th class="">订单</th>
						<th class="">客户</th>
						<th class="">操作</th>
					</tr>
				</thead>
				<tbody>
				<volist name="saleMen" id="saleman">
					<tr>
						<td class="" style="border:1px solid #30333F;">{$saleman.name}</td>
						<td class="" style="border:1px solid #30333F;">{$saleman.phone}</td>

						<td class="text-center" style="border:1px solid #30333F;"><a  href="{:U('SaleMan/details')}&id={$saleman.id}" class="btn btn-primary" >所有订单</a></td>
						<td class="text-center" style="border:1px solid #30333F;"><a  href="{:U('Relation/index')}&saler={$saleman.name}" class="btn btn-warning" >所有客户</a></td>
						<td colspan="1" style="border:1px solid #30333F;">
							<a href="{:U('SaleMan/deleteById')}&id={$saleman.id}" class="btn btn-danger ajax-get confirm" style="font-weight: 700;">删除</a>
						</td>
					</tr>
				</volist>
				</tbody>
				</table>
		</div>
	</div>
	<div class="modal fade bs-example-modal-sm" style="margin-top: 150px;" tabindex="" role="dialog" aria-labelledby="mySmallModalLabel">
		<div class="modal-dialog modal-md">
			<div class="modal-content text-center">
				<div class="modal-header text-center" style="color: #FFF;font-weight: 700;font-weight: 700;font-size: large;background: #008402">业务员信息</div>
				<div class="modal-body text-center" style="font-size: larger">
					<label for="name">
						姓名：
						<input type="text" id="name" name="name" autocomplete="off">
					</label>
					<br/>
					<label for="phone">
						手机：
						<input type="text" id="phone" name="phone" autocomplete="off">
					</label>

				</div>
				<div class="modal-footer text-center">
					<button type="button" id="formSubmit" class="btn btn-primary " style="color:#FFF;font-weight: 500" data-dismiss="modal" >确认</button>
					<button type="button" class="btn btn-danger " style="color:#FFF;font-weight: 500" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>
</block>
<block name="script">
	<script type="text/javascript" charset="utf-8">
		highlight_subnav('{:U('SaleMan/index')}');
		$("#formSubmit").click(function(){
			var name=$("#name").val();
			var phone=$("#phone").val();
			if(name==""||name==null){
				alert("请输入业务员信息");
				return false;
			}
			var check_url = '{:U('SaleMan/insert')}';
			$.ajax({
				url:check_url,
				data:{name:name,phone:phone},
				success:function(obj){
					if(obj==0){
						alert("添加失败");
					}else{
						window.location.reload();
					}
				}
			})
		});
	//导航高亮
	</script>
</block>

